"""Controller

class UserController(BaseController):
    validator = validator.UserValidator
    processor = processor.UserProcessor
    document = hal.UserSchema
    collection = hal.UserCollection
"""

HEAD = '''\
"""Your codes shoule be in impl.
"""
from ..validator import validators
from .. import processor as proc
from .. import hal
from .base import BaseController
'''

ALL = """
__all__ = [
{% for classname in lists %}\
    '{{ classname }}Controller',
{% endfor %}\
    'getfn',
]
"""

FUNCTIONS = """


def getfn(obj, attr):
    return getattr(obj, attr.lower())
"""

TEMPLATE = """

class {{ classname }}Controller(BaseController):
    \"\"\"{{ title }}

    Auto Generated Code.
    \"\"\"
    validator = validators.{{ classname }}Validator
    processor = proc.{{ classname }}ProcessorObj
    document = hal.{{ classname }}Schema
    collection = hal.{{ classname }}Collection

    def c(self, collection):
        return {'{{ tablename }}': collection}

"""
